package com.levi.test.proxy;

import org.springframework.cglib.proxy.Enhancer;

public class ExecuteMapper {

    public static <T> T getInstance(Class<T> clazz) {
        try {
            Enhancer enhancer = new Enhancer();
            enhancer.setCallback(new ExecuteProxy());
            enhancer.setSuperclass(clazz);
            return (T) enhancer.create();
        } catch (Exception e) {
            System.err.println(e.getMessage());
            return null;
        }
    }
}
